package Server;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class serverController implements ActionListener {

	serverView view;
	serverModel model;

	public serverController(serverView view, serverModel model) {
		this.view = view;
		this.model = model;

		view.cPanel.btn_start_Server.addActionListener(this);
		view.cPanel.btn_stop_Server.addActionListener(this);
		view.mBar.about_us.addActionListener(this);
		view.mBar.close_Application.addActionListener(this);
		view.mBar.website.addActionListener(this);
		view.mBar.rst_Server.addActionListener(this);
	}

	@Override
	public void actionPerformed(ActionEvent ae) {
		// Buttons
		if (ae.getActionCommand().equals("Start Server")) {
			model.startServer();
		}

		if (ae.getActionCommand().equals("Stop Server")) {
			model.stopServer();

		}
		// Button END
		// Menu
		if (ae.getActionCommand().equals("About us")) {
			System.out.println("About us");
			new aboutUs();
		}
		if (ae.getActionCommand().equals("Website")) {
			System.out.println("Website");
		}
		if (ae.getActionCommand().equals("Restart Server")) {
			System.out.println("Restart Server");
		}
		if (ae.getActionCommand().equals("Exit")) {
			System.out.println("Exit");
		}
		// Menu End
	}
}
